#!/usr/bin/env python

import DB2
from string import *

conn = DB2.connect(dsn='topcard', uid='wo', pwd='wangapeng')
curs = conn.cursor()

sql = '''
    select name,coltype,length,scale,keyseq
    from sysibm.syscolumns
    where tbname = '%s'
    ''' % upper('tbl_csm_crdbsc')

curs.execute(sql)
rows = curs.fetchall()
conn.close()

print len(rows)
for i in range(len(rows)):
    print str(rows[i])
